package com.principle.ocp;

/**
 * @author yangguanzan
 * @date 3/10/22
 * @description
 */
public class OffNovelBook extends NovelBook {

    private final static int GREATER_THAN_PRICE_OFF = 4000;

    public OffNovelBook(String name, int price, String author) {
        super(name,price,author);
    }

    @Override
    public int getPrice(){
        int price = super.getPrice();
        //大于40打9折
        if(price > GREATER_THAN_PRICE_OFF){
            return price*90/100;
        }
        //小于等于40打8折
        return price*80/100;
    }
}
